package com.weme.live.fragment

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

class MyPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {

    override fun getItemCount(): Int {
        return 2 // 两个 Fragment
    }

    override fun createFragment(position: Int): Fragment {
        // 根据位置返回相应的 Fragment
        return when (position) {
            0 -> LiveRoomNullFragment()
            1 -> LiveRoomFragment()
            else -> throw IllegalArgumentException("Invalid position: $position")
        }
    }
}
